import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'

import Layout from '../Layout.vue'

const router = createRouter({
  // history: createWebHistory(import.meta.env.BASE_URL),
  history: createWebHashHistory(),
  routes: [
    {
      // 默认显示内容页面
      
      
      path: '/layout',
      name: 'layout',
      component: Layout,
      alias:'/layout',
      children: [
        // 二级路由
        {
          //这个是默认显示画面 
          path: '/',
          name: 'echart',
          component: () => import('../Echart.vue')
        },
           // 用户列表路由
        {
          path: '/user_list',
          name: 'user_list',
          component: () => import('../views/user/ListView.vue')
        },
        // 发布轮播图路由
        {
          path: '/banner_add',
          name: 'banner_add',
          component: () => import('../views/banner/AddView.vue')
        },
        // 轮播图列表路由
        {
          path: '/banner_list',
          name: 'banner_list',
          component: () => import('../views/banner/ListView.vue')
        },
        // 添加文章路由
        {
          path: '/navi_add',
          name: 'navi_add',
          component: () => import('../views/navi/AddView.vue')
        },
        // 文章列表路由
        {
          path: '/navi_list',
          name: 'navi_list',
          component: () => import('../views/navi/ListView.vue')
        },
        // 考试分类路由
        {
          path: '/category',
          name: 'category',
          component: () => import('../views/exam/Category.vue')
        },
        // 考试管理路由
        {
          path: '/test_paper',
          name: 'test_paper',
          component: () => import('../views/exam/TestPaper.vue')
        },
        // 添加题目路由
        {
          path: '/topic',
          name: 'topic',
          component: () => import('../views/exam/Topic.vue')
        },
        // 题目列表路由
        {
          path: '/topic_list',
          name: 'topic_list',
          component: () => import('../views/exam/TopicList.vue')
        },
        // 记录成绩路由
        {
          path: '/score',
          name: 'score',
          component: () => import('../views/exam/Score.vue')
        },
        // 设置路由
        {
          path: '/setting',
          name: 'setting',
          component: () => import('../views/SetView.vue')
        },

      ]
    },
    {
      // 
      path: '/home',
      name: 'home',
      component: () => import('../views/HomeView.vue')
    },
    
    {
      // 登录页面路由
      path: '/login',
      name: 'login',
      component: () => import('../views/LoginView.vue')
    },
    {
      // 管理员页面路由
      path: '/admin',
      name: 'admin',
      component: () => import('../views/AdminView.vue')
    },
    {
      // 找回密码页面路由
      path: '/findpwd',
      name: 'findpwd',
      component: () => import('../views/FindPwd.vue')
    },
  ]
})

export default router
